<script>
	$(function() {
		
		sagapo.section_class_change('board');
		
		// 게시물 신규 추가.
		$("section.section .btn_right a.writes").click(function() {
			
			var href = $(this).attr("href");
			if(href) {
				loadDialogForm(href, null, $(this).text(), 800, 710, null, 'create');
			} else {
				alert("링크가 존재하지 않습니다.");
			}
			
			return false;
		});
		
		// 게시판 새창으로 열기
		$("section.board .container a.article h3 img.popup").click(function() {
			//var href = $(this).parent().parent().parent().attr("href");
			
			var href = "{CFG->PATH->WWW}/board/bbs/"+$(this).attr("data-bid");
			
			window.open(href);
			
			return false;
		});
		
		
		// 카테고리 관리
		$("section.board .container a.article .buttons button.category").click(function() {
			var bseq = $(this).attr("data-bseq");
			var bid = $(this).attr("data-bid");
			
			if(bseq) {
				var href = '{action}/category/'+bseq;
				
				loadDialogForm(href, null, bid + " " + $(this).text(), 600, 400, null, 'category');
			} else {
				alert('게시판 아이디가 존재하지 않습니다.');
			}
			
			return false;
		});
	});
</script>
	
<div class="list_container">
	<ul class="list">
		{? list}
			{@ list}
		<li>
			<a href="{action}/view/{.value_->ba_seq}" class="article">
				<div class="title">
					<h3>
						<span class="name_{.value_->ba_id}">{.value_->ba_name}</span> 
						<span class="count">({.value_->ba_count})</span> 
						<img src="{CFG->PATH->IMAGE}/icons/application_double.png" alt="새창" title="새창" class="popup" data-bid="{.value_->ba_id}" />
					</h3>
					
					<div class="buttons">
					{? .value_->ba_category}
						<button type="button" class="category" data-bseq="{.value_->ba_seq}" data-bid="{.value_->ba_id}" title="카테고리설정">카테고리설정</button>
					{/}
					</div>
				</div>
				<div class="description">
					<p class="date">생성일 : {.value_->date}</p>
				</div>
			</a>
		</li>
			{/}
		{:}
		<li class="no_list"> 등록된 게시판이 없습니다. </li>
		{/}
	</ul>
	<div class="list_footer">
		<div class="btn_right">
			<a href="{action}/add" class="icon_button writes">게시판 추가</a>
		</div>
		
	</div>
</div>